#
# CDDVDSourceViewItem.py
#
# This work is released under the GNU GPL, version 2 or later.
#

from qt import *
from SourceViewItem import *

#
# CD/DVD playlist
#
class CDDVDSourceViewItem(SourceViewItem):
	def __init__(self,container,library):
		name = library.name
		SourceViewItem.__init__(self,container,name)
		self.library = library
		self.source = library.playlistWithName('CD')
		self.setFont(11,True)

	def makeKey(self):
		return 'B'

	def iconFileName(self): return "sourcecddvd.png"

	def select(self,container):
		container.emit(PYSIGNAL("selectAudioCD"),(self.library,None))

	def buildPopup(self,mainWindow):
		self.popup = QPopupMenu()
		id = self.popup.insertItem(i18n("Import Tracks"),self.rip)
		id = self.popup.insertItem(i18n("Eject"),self.eject)
	
	

		print "attempting to rip"
		self.library.rip()
	
	def eject(self):
		self.library.drive.eject()
